package com.yingran.beiqi.activity.mapbox

import android.os.Bundle
import com.mapbox.mapboxsdk.maps.MapboxMap
import com.yingran.beiqi.R
import com.yingran.beiqi.activity.BaseActivity
import kotlinx.android.synthetic.main.activity_map_china.*

class ChinaMapActivity : BaseActivity() {
    private lateinit var mapboxMap: MapboxMap
    override fun titleType(): Title {
        return Title.None
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_map_china)
        backView.setOnClickListener { onBackPressed() }
        mapView.onCreate(savedInstanceState)
        mapView.getMapAsync { mapboxMap ->
            this@ChinaMapActivity.mapboxMap = mapboxMap
//            val mapText = mapboxMap.getLayer("country-label-lg")
//            mapText?.setProperties(textField("{name_fr}"))
        }
    }

    public override fun onResume() {
        super.onResume()
        mapView.onResume()
    }

    override fun onStart() {
        super.onStart()
        mapView.onStart()
    }

    override fun onStop() {
        super.onStop()
        mapView.onStop()
    }

    public override fun onPause() {
        super.onPause()
        mapView.onPause()
    }

    override fun onLowMemory() {
        super.onLowMemory()
        mapView.onLowMemory()
    }

    override fun onDestroy() {
        super.onDestroy()
        mapView.onDestroy()
    }

    override fun onSaveInstanceState(outState: Bundle) {
        super.onSaveInstanceState(outState)
        mapView.onSaveInstanceState(outState)
    }
}